package antempire.control.game.operation.wateroperation;

import java.util.HashMap;

import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.opengl.texture.region.TextureRegion;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;
import org.anddev.andengine.ui.activity.BaseGameActivity;

import antempire.control.GameSound;
import antempire.control.game.GameConstants;

public class WaterController implements GameConstants {

	private static WaterController uniqueInstance;

	private static WaterSprite water = null;
	private final WaterOperation waterOperation = new WaterOperation();

	private TiledTextureRegion waterTextureRegion;

	private static HashMap<Integer, TextureRegion> allNumberTextureRegionMap = new HashMap<Integer, TextureRegion>();

	private WaterController() {
	}

	public static WaterController getInstance() {
		if (uniqueInstance == null) {
			uniqueInstance = new WaterController();
		}
		return uniqueInstance;
	}

	public void waterInitialization(TiledTextureRegion waterTextureRegion,
			HashMap<Integer, TextureRegion> allNumberTextureRegionMap,
			Scene scene) {


		this.waterTextureRegion = waterTextureRegion;
		this.allNumberTextureRegionMap.putAll(allNumberTextureRegionMap);

	}

	public WaterSprite lauchWater(float x, float y, TiledTextureRegion captureWaterTextureRegionMap, BaseGameActivity activity, GameSound mSound) {
		
			mSound.lauchWater();

			return waterOperation.lauchWater(captureWaterTextureRegionMap, x, y, activity);
	}

	/*private void showCoins(Scene scene) {
		int thousand = mInitialCoin / 1000;
		int hundred = (mInitialCoin - thousand * 1000) / 100;
		int ten = (mInitialCoin - thousand * 1000 - hundred * 100) / 10;
		int one = mInitialCoin - thousand * 1000 - hundred * 100 - ten * 10;

		Sprite thousandSprite = new Sprite(75, 295, allNumberTextureRegionMap
				.get(thousand).clone());
		Sprite hundredSprite = new Sprite(95, 295, allNumberTextureRegionMap
				.get(hundred).clone());
		Sprite tenSprite = new Sprite(115, 295, allNumberTextureRegionMap.get(
				ten).clone());
		Sprite oneSprite = new Sprite(135, 295, allNumberTextureRegionMap.get(
				one).clone());

		thousandSprite.setSize(20, 25);
		hundredSprite.setSize(20, 25);
		tenSprite.setSize(20, 25);
		oneSprite.setSize(20, 25);

		scene.attachChild(thousandSprite);
		scene.attachChild(hundredSprite);
		scene.attachChild(tenSprite);
		scene.attachChild(oneSprite);

	}*/

}
